﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using KPIS.GERP.GHRMS.BLL;
using KPIS.GERP.GHRMS.IBLL;
using KPIS.GERP.GHRMS.MODEL;

namespace KPIS.GERP.GHRMS.APP.App_UI.Forms
{
    public partial class PS_RoyalItems : System.Web.UI.Page
    {
        IRoyalItemBLL royalBLL = new RoyalItemBLL();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadDataGrid();
            }
        }
        public void LoadDataGrid()
        {
            IList<RoyalItemInfo> Info = royalBLL.ListRoyalItems();
            RadGrid1.DataSource = Info;

            //GridGroupByExpression g = new GridGroupByExpression(RadGrid1.Columns[5]);
            //RadGrid1.MasterTableView.GroupByExpressions.Add(g);

            RadGrid1.DataBind();
        }

        protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
        {
            if (e.CommandName == "Delete")
            {
                int seq = Convert.ToInt32((e.Item as GridDataItem).OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Sequence"]);
                royalBLL.Delete(seq, 1);
            }
            LoadDataGrid();
        }
    }
}
